package com;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.HashMap;

public class Person {
    public static void main(String[] args) throws Exception{

        Class.forName("com.mysql.jdbc,Driver");
        Connection con=DriverManager.getConnection("jdbc:mysql//localhost:3306/yueqian","root","");
        String sql="create table Student( id int primary key auto_increment, username varchar(32), password varchar(32), age int,sex enum('男','女'))";
        PreparedStatement pre= con.prepareStatement(sql);
        boolean result= pre.execute();
        System.out.println("创建学生表结果"+result);
        String sql1="insert into Student value(null,andy,123,25,男)";
        PreparedStatement pre1=  con.prepareStatement(sql1);
        int result1 =   pre.executeUpdate();
        System.out.println("插入学生表结果"+result1);

    }
}
